// 销售/购货明细
const {DataTypes, db } = require("../db");
db.define('invoiceInfo', {
id: {type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true,comment:'表自增ID'},
tenantId:{type: DataTypes.INTEGER,comment:'租户ID'}, 
iid:{type: DataTypes.INTEGER,allowNull:false,comment:'关联ID'}, 
locationId:{type: DataTypes.SMALLINT,allowNull:false,comment:'仓库ID'}, 
locationName:{type: DataTypes.STRING(100),allowNull:false,defaultValue:(''),comment:'仓库'}, 
billNo:{type: DataTypes.STRING(50),allowNull:false,comment:'票号'}, 
trans:{type: DataTypes.STRING(50),defaultValue:(''),comment:'换入/换出'}, 
invId:{type: DataTypes.INTEGER,allowNull:false,comment:'商品ID'}, 
invName:{type: DataTypes.STRING(255),allowNull:false,defaultValue:(''),comment:'商品名称'}, 
spec:{type: DataTypes.INTEGER,allowNull:false,defaultValue:1,comment:'规格'}, 
calNum:{type: DataTypes.INTEGER,allowNull:false,defaultValue:0,comment:'1拆零换算系数'}, 
unit:{type: DataTypes.STRING(50),allowNull:false,defaultValue:(''),comment:'单位'}, 
unitId:{type: DataTypes.INTEGER,allowNull:false,comment:'单位Id'},
qty:{type: DataTypes.DECIMAL(20, 2),allowNull:false,defaultValue:0,comment:'数量'},
assQty:{type: DataTypes.STRING(100),defaultValue:(''),comment:'辅助数量'}, 
price:{type: DataTypes.DECIMAL(20, 8),defaultValue:0,comment:'单价'}, 
deduction:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'每件返现金额'}, 
amount:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'金额-返现金额'}, 
send:{type: DataTypes.STRING(50),defaultValue:(''),comment:'赠品类型'}, 
sendId:{type: DataTypes.INTEGER,defaultValue:0,comment:'send表ID'}, 
isYs:{type: DataTypes.INTEGER,defaultValue:0,comment:'预收商品=1'}, 
ysId:{type: DataTypes.INTEGER,defaultValue:0,comment:'invoice_info_ys表的ID,预收 商品ID'}, 
srcOrderNo:{type: DataTypes.STRING(100),defaultValue:(''),comment:'源单号'}, 
remark:{type: DataTypes.STRING(1000),defaultValue:(''),comment:'备注'}, 
ysIid:{type: DataTypes.INTEGER,defaultValue:0,comment:'老系统预收 商品ID'}, 
totalAmount:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'总金额'}, 
ysAmount:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'使用预收款金额'}, 
amountReal:{type: DataTypes.DECIMAL(18, 2),defaultValue:0,comment:'真实金额方向'}, 
hxAmount:{type: DataTypes.DECIMAL(19, 2),defaultValue:0,comment:'使用预收款金额,核销金额'}, 
sendChild:{type: DataTypes.TEXT,defaultValue:(''),comment:'这条商品下的赠品ID'}, 
serialNo:{type: DataTypes.STRING(200),defaultValue:(''),comment:'批次号'}, 
qtyReal:{type: DataTypes.DECIMAL(20, 2),defaultValue:0,comment:'真实数量方向'}, 
transType:{type: DataTypes.INTEGER,defaultValue:0,comment:'业务类型'}, 
buId:{type: DataTypes.INTEGER,defaultValue:0,comment:'往来单位ID'}, 
transTypeName:{type: DataTypes.STRING(255),comment:'业务名称'}, 
billType:{type: DataTypes.STRING(255),comment:'票据类型'}, 
oldId:{type: DataTypes.INTEGER,comment:''}, 
sendMainUuid:{type: DataTypes.STRING(64),defaultValue:(''),comment:'赠品主条目UUId'}, 
sendSubUuid:{type: DataTypes.STRING(64),defaultValue:(''),comment:'赠品条目UUID'}, 
billState:{type: DataTypes.STRING(50),comment:''}, 

}, {
    tableName: 'invoice_info',
    timestamps: false,
    comment: '销售/购货明细',
    
});